In this paper we derive the galaxy luminosity function from the Nearby Optical Galaxy (NOG) sample, which is a nearly complete, magnitude-limited (B<14 mag), all-sky sample of nearby optical galaxies (~6400 galaxies with cz<5500 km/s). For this local sample, we use galaxy distance estimates based on different peculiar velocity models. Therefore, the derivation of the luminosity function is carried out using the locations of field and grouped galaxies in real distance space. The local field galaxy luminosity function in the B system is well described by a Schechter function. The exact values of the Schechter parameters slightly depend on the adopted peculiar velocity field models. The shape of the luminosity function of spiral galaxies does not differ significantly from that of E-S0 galaxies. On the other hand, the late-type spirals and irregulars have a very steeply rising luminosity function towards the faint end, whereas the ellipticals appreciably decrease in number towards low luminosities. The presence of galaxy systems in the NOG sample does not affect significantly the field galaxy luminosity function, since environmental effects on the total luminosity function appear to be marginal.